
(function(ns){

var Asset = ns.Asset = Hilo.Class.create({
    Mixes: Hilo.EventMixin,

    queue: null,
    bg: null,
    aircraft: null,
    homeBmImg: null,
    shell: null,
    missile: null,
    num: null,
    number:null,
	tank: null,
	tanks: null,
	numberGlyphs:null,
	ninja:null,
	boss:null,
	bossMissile:null,
	missileParticles:null,
	
	soundBomb:null,
	missileFlight:null,
	tankShooting:null,
    load: function(){
        var resources = [
            {id:'bg', src:'imgs/bg.jpg'},
            {id:'aircraft', src:'imgs/aircraft.png'},
            {id:'homeBmImg', src:'imgs/bottom.png'},
            {id:'shell', src:'imgs/ArtilleryShell.png'},
            {id:'missile', src:'imgs/missile.png'},
            {id:'num', src:'imgs/num.png'},
            {id:'number', src:'imgs/number.png'},
            {id:'QRcode', src:'imgs/QRcode.png'},
            {id:'tank', src:'imgs/tank.png'},
            {id:'tanks', src:'imgs/tanks4.png'},
            {id:'ninja', src:'imgs/Ninja.png'},
            {id:'boss', src:'imgs/boss2.png'},
            {id:'bossMissile', src:'imgs/bossMissile.png'},
            {id:'missileParticles', src:'imgs/MissileParticles.png'},
            
            //{id:'soundBomb', src:'sounds/bomb.mp3'}
        ];

        this.queue = new Hilo.LoadQueue();
        this.queue.add(resources);
        this.queue.on('complete', this.onComplete.bind(this));
        this.queue.start();
    },

    onComplete: function(e){
        this.bg = this.queue.get('bg').content;
        this.aircraft = this.queue.get('aircraft').content;
        this.homeBmImg = this.queue.get('homeBmImg').content;
        this.shell = this.queue.get('shell').content;
        this.num = this.queue.get('num').content;
        this.number = this.queue.get('number').content;
        this.missile=this.queue.get('missile').content;
        this.QRcode=this.queue.get('QRcode').content;
        this.tank=this.queue.get('tank').content;
        this.tanks=this.queue.get('tanks').content;
        this.soundBomb='sounds/bomb.mp3';
        this.missileFlight='sounds/missileFlight.wav';
        this.tankShooting='sounds/tankShooting2.wav';
        this.ninja=this.queue.get('ninja').content;
        this.boss=this.queue.get('boss').content;
        this.bossMissile=this.queue.get('bossMissile').content;
        this.missileParticles=this.queue.get('missileParticles').content;
//      this.carAtlas = new Hilo.TextureAtlas({
//          image: this.car,
//          frames: [
//              [0, 120, 86, 60], 
//              [0, 60, 86, 60], 
//              [0, 0, 86, 60]
//          ],
//          sprites: {
//              bird: [0, 1, 2]
//          }
//      });
//
        var number = this.queue.get('number').content;
        this.numberGlyphs = {
            0: {image:number, rect:[0,0,60,91]},
            1: {image:number, rect:[61,0,60,91]},
            2: {image:number, rect:[121,0,60,91]},
            3: {image:number, rect:[191,0,60,91]},
            4: {image:number, rect:[261,0,60,91]},
            5: {image:number, rect:[331,0,60,91]},
            6: {image:number, rect:[401,0,60,91]},
            7: {image:number, rect:[471,0,60,91]},
            8: {image:number, rect:[541,0,60,91]},
            9: {image:number, rect:[611,0,60,91]}
        };
//
      this.queue.off('complete');
      this.fire('complete');
    }
});

})(window.game);